<?php
class CodeSpace_Oauth_Server_Token extends Zend_Oauth_Token
{
    private $_status = null;
    private $_authenticated = null;
    private $_valid = false;
    
    public function __construct()
    {
        parent::__construct();
    }
    
    public function setToken($token)
    {
        if(class_exists('Model_DbTable_Tokens'))
        {
            $tokenTable = new Model_DbTable_Tokens();
            $resultSet = $tokenTable->find($token);
            
            if($resultSet->count() == 1)
            {
                $row = $resultSet->current();
                parent::setToken($token);
                parent::setTokenSecret($row->tkn_token_secret);
                $this->setStatus($row->tkn_state);
                $this->setAuthenticated($row->tkn_authenticated);
                $this->_valid = true;
            }else
            {
                $this->_valid = false;
            }    
        }else
        {
            parent::setToken($token);
        }
        
        return $this;
    }
	/**
     * @return the $_status
     */
    public function getStatus ()
    {
        return $this->_status;
    }

	/**
     * @return the $_authenticated
     */
    public function isAuthenticated ()
    {
        return $this->_authenticated;
    }

	/**
     * @param field_type $_status
     */
    public function setStatus ($_status)
    {
        $this->_status = $_status;
    }

	/**
     * @param field_type $_authenticated
     */
    public function setAuthenticated ($_authenticated)
    {
        $this->_authenticated = $_authenticated;
    }
  
    
    
}
?>